gdk_seat_get_pointer
gdk_seat_get_keyboard
gdk_seat_get_physical_devices
+gdk_seat_get_tools
<SUBSECTION Standard>
GDK_SEAT
#include <glib-object.h>
#include "gdkdisplay.h"
#include "gdkdevice.h"
+#include "gdkdevicetoolprivate.h"
#include "gdkseatprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkintl.h"
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial,
guint64 hw_id)
+{
+ GdkDeviceTool *match = NULL;
+ GList *tools, *l;
+
+ tools = gdk_seat_get_tools (seat);
+
+ for (l = tools; l; l = l->next)
+ {
+ GdkDeviceTool *tool = l->data;
+
+ if (tool->serial == serial && tool->hw_id == hw_id)
+ {
+ match = tool;
+ break;
+ }
+ }
+
+ g_list_free (tools);
+
+ return match;
+}
+
+/**
+ * gdk_seat_get_tools:
+ * @seat: A #GdkSeat
+ *
+ * Returns all #GdkDeviceTool<!-- -->s that are known to the
+ * application.
+ *
+ * Returns: (transfer container) (element-type Gdk.DeviceTool): A list of tools. Free with
+ * g_list_free().
+ **/
+GList *
+gdk_seat_get_tools (GdkSeat *seat)
{
GdkSeatClass *seat_class;
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
seat_class = GDK_SEAT_GET_CLASS (seat);
- return seat_class->get_tool (seat, serial, hw_id);
+ return seat_class->get_tools (seat);
}
GList * gdk_seat_get_physical_devices (GdkSeat *seat,
GdkSeatCapabilities capabilities);
+GList * gdk_seat_get_tools (GdkSeat *seat);
+
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_seat_get_pointer (GdkSeat *seat);
GDK_AVAILABLE_IN_ALL
return devices;
}
-static GdkDeviceTool *
-gdk_seat_default_get_tool (GdkSeat *seat,
- guint64 serial,
- guint64 hw_id)
+static GList *
+gdk_seat_default_get_tools (GdkSeat *seat)
{
GdkSeatDefaultPrivate *priv;
GdkDeviceTool *tool;
+ GList *tools = NULL;
guint i;
priv = gdk_seat_default_get_instance_private (GDK_SEAT_DEFAULT (seat));
for (i = 0; i < priv->tools->len; i++)
{
tool = g_ptr_array_index (priv->tools, i);
-
- if (tool->serial == serial && tool->hw_id == hw_id)
- return tool;
+ tools = g_list_prepend (tools, tool);
}
- return NULL;
+ return tools;
}
static void
seat_class->get_logical_device = gdk_seat_default_get_logical_device;
seat_class->get_physical_devices = gdk_seat_default_get_physical_devices;
-
- seat_class->get_tool = gdk_seat_default_get_tool;
+ seat_class->get_tools = gdk_seat_default_get_tools;
}
static void
GList * (* get_physical_devices) (GdkSeat *seat,
GdkSeatCapabilities capabilities);
- GdkDeviceTool * (* get_tool) (GdkSeat *seat,
- guint64 serial,
- guint64 tool_id);
+ GList * (* get_tools) (GdkSeat *seat);
};
void gdk_seat_device_added (GdkSeat *seat,
return physical_devices;
}
+static GList *
+gdk_wayland_seat_get_tools (GdkSeat *seat)
+{
+ GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
+ GList *tools = NULL, *l;
+
+ for (l = wayland_seat->tablet_tools; l; l = l->next)
+ {
+ GdkWaylandTabletToolData *tool = l->data;
+
+ tools = g_list_prepend (tools, tool->tool);
+ }
+
+ return tools;
+}
+
static void
gdk_wayland_seat_class_init (GdkWaylandSeatClass *klass)
{
seat_class->ungrab = gdk_wayland_seat_ungrab;
seat_class->get_logical_device = gdk_wayland_seat_get_logical_device;
seat_class->get_physical_devices = gdk_wayland_seat_get_physical_devices;
+ seat_class->get_tools = gdk_wayland_seat_get_tools;
}
static void